package com.class07;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2024/3/29 9:04
 */
public class AnimalTest {
    public static void main(String[] args) {
//        Dog dog = new Dog();
//        dog.name = "旺财";
//        dog.setLogs(4);
//        System.out.println(dog.getLogs());
        Dog animal = new Dog();
        animal.name = "旺财";
        animal.setLogs(4);



    }
}
class Animal { //动物
    // 属性
    String name;//名字
    private int legs;//腿的个数

    public void setLogs(int l){
        if(l >= 0 && l %2 == 0){
            legs = l;
        }else {
            System.out.println("你输入不合法");
        }
        System.out.println("你输入的腿数是：" + legs);
    }

    public int getLogs(){
        return legs;



    }
   private  void eat(){
        System.out.println("吃东西");
    }

}

class Dog extends Animal{//extends
}

class Person{//extends
    private Animal animal;
}
